<div class="form-container">
<div class="validation-errors" id="validationErrors" style="display:none;"></div>
<div class="walk-register-buttons" style="float: left;">
<a href="<?php echo( base_url() ); ?>cmb/member/home/<?php echo( $urlKey ); ?>/" target="_self">Member Home</a>
->&nbsp<a href="<?php echo( base_url() ); ?>cmb/member_reports/gen_reports/<?php echo( $urlKey ); ?>/" target="_self">Reports Home</a>
->&nbsp<a href="<?php echo( base_url() ); ?>cmb/member_reports/gen_reports_mahasamadhi_home/<?php echo( $urlKey ); ?>/" target="_self">Mahasamadhi Reports Home</a>
->&nbsp<a href="<?php echo( base_url() ); ?>cmb/member_reports/mahasamadhi_registrants_hotel_report_process/<?php echo( $urlKey ); ?>/" target="_self">Registrants Search</a>
</div>
<div class="walk-register-buttons" style="float: right;">
	<a href="<?php echo( base_url() ); ?>cmb/member/homepage_logout/"><img src="<?php echo( base_url() ); ?>assets/images/buttons/logout1.gif" border="0" /></a>
</div>

<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );
			
	Spacer::Render(0, 40);

	echo('<div>');
	echo '<a href="'.base_url().'cmb/member_reports/download_mahasamadhi_hotel_registrants_report/'.$urlKey.'/" target="_self">Download Multi-Record Data</a>';
    echo('</div>');
    echo('<div>');
    echo '<a href="'.base_url().'cmb/member_reports/download_mahasamadhi_hotel_special_report/'.$urlKey.'/" target="_self">Download Single-Record Data</a>';
    echo('</div>');

	Spacer::Render(0, 20);
	
	$curdatetime = time();
	
	$curdate = date('l, F jS, Y', $curdatetime);
	Form::OpenFormItemSummary('Date:', 50);
		echo( form_label($curdate, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();

	$curtime = date('h:i:s A', $curdatetime);
	Form::OpenFormItemSummary('Time:', 50);
		echo( form_label($curtime, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();

	Form::OpenFormItemSummary('Year:', 260);
		echo( form_label($year, 'year', 'style="width: 20px;" ') );
	Form::CloseFormItem();
	
	Form::OpenFormItemSummary('Number of search results:', 260);
		echo( form_label(count($mrhinfoarr), 'srchres', 'style="width: 20px;" ') );
	Form::CloseFormItem();
	echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');

	if (count($mrhinfoarr) > 0)
	{
		Spacer::Render(0, 20);
		echo ( form_label('<b><font size="2" color="black">Search Criteria</b></font>','biksha',array('class'=>'biksha','style'=>'clear: left; float: left; text-align: left; margin: 0 10px 0 0; width: 600px;')) );
		Spacer::Render(0, 20);
		echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');
	
		echo('<div class="form-item"><div class="form-item-key" style="margin: 0 10px 0 0; width: 100px;">First Name:</div><div class="form-item-value" style="width: 250px;">');
			if (!empty($searchcriteria['registrantfirstname']))
				echo ( form_label('<font size="2" color="black">'.$searchcriteria['registrantfirstname'].'%</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
			else
				echo ( form_label('<font size="2" color="black">All</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
		echo('</div><div class="clear"></div></div>');
		
		echo('<div class="form-item"><div class="form-item-key" style="margin: 0 10px 0 0; width: 100px;">Last Name:</div><div class="form-item-value" style="width: 250px;">');
			if (!empty($searchcriteria['registrantlastname']))
				echo ( form_label('<font size="2" color="black">'.$searchcriteria['registrantlastname'].'%</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
			else
				echo ( form_label('<font size="2" color="black">All</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
		echo('</div><div class="clear"></div></div>');
	
		echo('<div class="form-item"><div class="form-item-key" style="margin: 0 10px 0 0; width: 100px;">City:</div><div class="form-item-value" style="width: 250px;">');
			if (!empty($searchcriteria['registrantcity']))
				echo ( form_label('<font size="2" color="black">'.$searchcriteria['registrantcity'].'%</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
			else
				echo ( form_label('<font size="2" color="black">All</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
		echo('</div><div class="clear"></div></div>');
	
		echo('<div class="form-item"><div class="form-item-key" style="margin: 0 10px 0 0; width: 100px;">State:</div><div class="form-item-value" style="width: 250px;">');
			if ((!empty($searchcriteria['registrantstate'])) and ($searchcriteria['registrantstate'] != "All"))
				echo ( form_label('<font size="2" color="black">'.$searchcriteria['registrantstate'].'</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
			else
				echo ( form_label('<font size="2" color="black">All</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
		echo('</div><div class="clear"></div></div>');
	
		echo('<div class="form-item"><div class="form-item-key" style="margin: 0 10px 0 0; width: 100px;">Country:</div><div class="form-item-value" style="width: 250px;">');
			if ((!empty($searchcriteria['registrantcountry'])) and ($searchcriteria['registrantcountry'] != "All"))
				echo ( form_label('<font size="2" color="black">'.$searchcriteria['registrantcountry'].'</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
			else
				echo ( form_label('<font size="2" color="black">All</font>','',array('class'=>'fn','style'=>'width: 250px;')) );
		echo('</div><div class="clear"></div></div>');
	
		echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');
		Spacer::Render(0, 10);
		
		Spacer::Render(0, 20);
		$ir = 0;		
		foreach( $mrhinfoarr as $mrhobj)
		{
            $mrv = Mahasamadhi_registration_value::cast( $mrhobj );

            echo('<table border="1" bgcolor = "#D3D3D3" cellpadding="5" width="100%">');
            echo('<tr>');
            echo('<th><center>&nbsp<b>Reg&nbspCode</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Occupancy</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>City</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>State</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Country</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Zip</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Email</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Phone</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>#Adult&nbspReg</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>#Child&nbspReg</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Wheel&nbspChair</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Special&nbspNeeds&nbspRoom</b>&nbsp</center></th>');
            echo('<th><center>&nbsp<b>Date&nbspCreated</b>&nbsp</center></th>');
            echo('</tr>');

        

			if ($ir % 2 != 0)
			{
				$rowColor = "#e0ffff";
			}
			else
			{
				$rowColor = "#ffffff";
			}

			echo('<tr bgcolor="'.$rowColor.'">');
			
            if ($mrv->getSpecialNeedsWheelchair() == 0)
                $snwc = "n/a";
            else
                $snwc = "yes";

            if ($mrv->getSpecialNeedsRoom() == 0)
                $snrm = "n/a";
            else
                $snrm = "yes";

            $numAdult = $mrv->getNumAdultRegistered() + $mrv->getNumCHYKRegistered();

			echo('<td><center>&nbsp'.$mrv->getRegCode().'&nbsp</center></td>');
            echo('<td><center>&nbsp'.$mrv->getRegistrationCaseDescription().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$mrv->getCity().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$mrv->getState().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$mrv->getCountry().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$mrv->getZip().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$mrv->getEmail().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$mrv->getPhone().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$numAdult.'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$mrv->getNumChildRegistered().'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$snwc.'&nbsp</center></td>');
			echo('<td><center>&nbsp'.$snrm.'&nbsp</center></td>');
            echo('<td><center>&nbsp'.$mrv->getDateCreated().'&nbsp</center></td>');
 
			
			echo('</tr>');
						
			$ir++;
    
            echo('</table>');

            if (($mrv->getNumAdultRegistered() > 0) || ($mrv->getNumCHYKRegistered() > 0)  || ($mrv->getNumChildRegistered() > 0))
            {
                echo('<table border="1" bgcolor = "#D3D3D3" cellpadding="5" width="100%">');
                echo('<tr>');
                echo('<th><center>&nbsp<b>First&nbspName</b>&nbsp</center></th>');
                echo('<th><center>&nbsp<b>Last&nbspName</b>&nbsp</center></th>');
                echo('<th><center>&nbsp<b>Gender</b>&nbsp</center></th>');
                echo('<th><center>&nbsp<b>Age</b>&nbsp</center></th>');
                echo('</tr>');
            }
            
            $numAdult = $mrv->getNumAdultRegistered();
            if ($numAdult > 0)
            {
                $ir = 0;        
                for($i=0; $i<$numAdult; $i++)
                {
                    $adultInfoArr = $mrv->getAdultInfo();
                    $adultRec = $adultInfoArr[$i];
                    
                    if ($ir % 2 != 0)
                    {
                        $rowColor = "#e0ffff";
                    }
                    else
                    {
                        $rowColor = "#ffffff";
                    }

                    echo('<tr bgcolor="'.$rowColor.'">');            
                    echo('<td><center>&nbsp'.$adultRec["firstname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$adultRec["lastname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$adultRec["gender"].'&nbsp</center></td>');
                    echo('<td><center>&nbspAdult&nbsp</center></td>');
                    echo('</tr>');
                    
                    $ir++;
                }                                
            }
            
            $numCHYK = $mrv->getNumCHYKRegistered();
            if ($numCHYK > 0)
            {
                $ir = 0;
                for($i=0; $i<$numCHYK; $i++)
                {
                    $chykInfoArr = $mrv->getCHYKInfo();
                    $chykRec = $chykInfoArr[$i];
                    
                    if ($ir % 2 != 0)
                    {
                        $rowColor = "#e0ffff";
                    }
                    else
                    {
                        $rowColor = "#ffffff";
                    }

                    echo('<tr bgcolor="'.$rowColor.'">');            
                    echo('<td><center>&nbsp'.$chykRec["firstname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$chykRec["lastname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$chykRec["gender"].'&nbsp</center></td>');
                    echo('<td><center>&nbspAdult&nbsp</center></td>');
                    echo('</tr>');
                    
                    $ir++;
                }
            }

            $numChild = $mrv->getNumChildRegistered();
            if ($numChild > 0)
            {
                $ir = 0;        
                for($i=0; $i<$numChild; $i++)
                {
                    $childInfoArr = $mrv->getChildInfo();
                    $childRec = $childInfoArr[$i];
                    
                    if ($ir % 2 != 0)
                    {
                        $rowColor = "#e0ffff";
                    }
                    else
                    {
                        $rowColor = "#ffffff";
                    }

                    echo('<tr bgcolor="'.$rowColor.'">');            
                    echo('<td><center>&nbsp'.$childRec["firstname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$childRec["lastname"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$childRec["gender"].'&nbsp</center></td>');
                    echo('<td><center>&nbsp'.$childRec["age"].'&nbsp</center></td>');
                    echo('</tr>');

                    $ir++;
                }
                                
                echo('</table>');                
            }

            if (($mrv->getNumAdultRegistered() > 0) || ($mrv->getNumCHYKRegistered() > 0) || ($mrv->getNumChildRegistered() > 0))
                echo('</table>');                
            
            Spacer::Render(0, 50);
		}

	}
	else
		echo "No results returned";
?>
</div>
